home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Include / Extras / LayoutGT.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  6.8 KB  |  192 lines

  1. #ifndef EXTRAS_LAYOUTGT_H
  2. #define EXTRAS_LAYOUTGT_H
  3.  
  4. #ifndef EXEC_TYPES_H
  5. #include "exec/types.h"
  6. #endif /* EXEC_TYPES_H */
  7.  
  8. #ifndef UTILITY_TAGITEM_H
  9. #include <utility/tagitem.h>
  10. #endif /* UTILITY_TAGITEM_H */
  11.  
  12. #ifndef    GRAPHICS_GFX_H
  13. #include <graphics/gfx.h>
  14. #endif /* GRAPHICS_GFX_H */
  15.  
  16. #define LG_Dummy    (TAG_USER)
  17.  
  18. #define LG_DebugMode      (LG_Dummy + 0) /* Debug Mode */
  19. #define LG_CreateGadget   (LG_Dummy + 1) /* (struct Gadget **) or NULL  */
  20. #define LG_NewGadget      (LG_Dummy + 2) /* (struct NewGadget *) */
  21.  
  22. /* 
  23.   Note: High Word of dimensions are used for relational flags.
  24.   See LG_REL_ macros.
  25. */   
  26.  
  27. #define LG_LeftEdge       (LG_Dummy + 3)
  28. #define LG_XPos           LG_LeftEdge    /* Just an alias */
  29. #define LG_TopEdge        (LG_Dummy + 4)
  30. #define LG_YPos           LG_TopEdge
  31. #define LG_Width          (LG_Dummy + 5)
  32. #define LG_Height         (LG_Dummy + 6)
  33.  
  34. #define LG_GadgetText     (LG_Dummy + 7)
  35. #define LG_TextAttr       (LG_Dummy + 8)
  36. #define LG_GadgetID       (LG_Dummy + 9)
  37. #define LG_Flags          (LG_Dummy + 10)
  38. #define LG_VisualInfo     (LG_Dummy + 11)
  39. #define LG_UserData       (LG_Dummy + 12)
  40. #define LG_GadgetKind     (LG_Dummy + 13)
  41. #define LG_GadgetTags     (LG_Dummy + 14)   /* The next ti_Data tags are GTXX_ tags */
  42. #define LG_GadgetTagList  (LG_Dummy + 15)
  43. #define LG_OffsetX        (LG_Dummy + 16)   /* global offset from left of window - note that this will be added to LG_UseScreenOffsets & LG_UseWindowOffsets*/
  44. #define LG_OffsetY        (LG_Dummy + 17)   /* global offset from top of window */
  45. #define LG_LabelFlags     (LG_Dummy + 18)   /* see LGLF_ */
  46. #define LG_ScaleX         (LG_Dummy + 19)
  47. #define LG_ScaleY         (LG_Dummy + 20)   /* scale * 65535 */
  48. #define LG_Justification  (LG_Dummy + 21)   /* see LG_JUST_? */
  49. #define LG_UseScreenOffsets (LG_Dummy + 22) /* (struct Screen *) or NULL - sets global offsets based on Window border dimensions specified in the Screen structure */
  50. #define LG_UseWindowOffsets (LG_Dummy + 23) /* (struct Window *) or NULL - sets global offsets based on Window border dimensions */
  51. #define LG_EraseRemoved     (LG_Dummy + 24) /* (BOOL) erase gadges when they're removed using LG_RemoveGadgets (defualt TRUE ) */
  52.  
  53. #define LG_KeyClass         (LG_Dummy + 25) /* Not used */
  54. #define LG_KeyString        (LG_Dummy + 26) /* A string of characters that "activate" that gadget, if not specified, LG_CreateGadget() will scan the gadget label for the appropriate string */
  55. #define LG_ErrorCode        (LG_Dummy + 27) /* Not used */
  56. /* Bounding area for gadgets */
  57.  
  58. #define LG_Bounds           (LG_Dummy + 28) /* (struct IBox *) set offsets of area for gadgets */
  59. /* individual tags for LG_Bounds */
  60. #define LG_BoundsLeft        (LG_OffsetX)   // Aliases
  61. #define LG_BoundsTop         (LG_OffsetY)
  62. #define LG_BoundsWidth       (LG_Dummy + 29)
  63. #define LG_BoundsHeight      (LG_Dummy + 30)
  64.  
  65. #define LG_RelHorizGap       (LG_Dummy + 31)  /* Gap between certain relative operations */
  66. #define LG_RelVertGap        (LG_Dummy + 32)
  67.  
  68. #define LG_HorizCells        (LG_Dummy + 33)  /* 0 - 65535 */
  69. #define LG_VertCells         (LG_Dummy + 34)  /* 0 - 65535 */
  70.  
  71. #define LG_SkipGadgets       (LG_Dummy + 35)  /* Skip the next ti_Data LG_CreateGadgets and all Tags in between.  */
  72.  
  73. /* Not implemented */
  74. #define LG_SuperBounds       (LG_Dummy + 36) /* ??? (struct IBox *) to use relative dimensions on Bounds ??? */
  75.  
  76. #define LG_GetMinHeight      (LG_Dummy + 37) /* (LONG *) Minimum gadget size, should be initialized to 0's */
  77. #define LG_GetMinWidth       (LG_Dummy + 38) /* */
  78. #define LG_AddMinHeight      (LG_Dummy + 39) /* (LONG *) Add Minimum gadget size */
  79. #define LG_AddMinWidth       (LG_Dummy + 40) /* */
  80.  
  81. #define LG_GroupGadgets
  82. #define LG_GroupName
  83. #define LG_GroupFlags
  84.  
  85. /* LG_LabelFlags */
  86. #define LGLF_FITLABEL  (1<<0)
  87.  
  88. /* LG_Justufication flags */
  89. #define LG_JUST_HORIZ_MASK  0xf
  90. #define LG_JUST_LEFT        0x0
  91. #define LG_JUST_HCENTER     0x1
  92. #define LG_JUST_RIGHT       0x2 
  93.  
  94. #define LG_JUST_VERT_MASK   0xf0
  95. #define LG_JUST_TOP         0x00
  96. #define LG_JUST_VCENTER     0x10
  97. #define LG_JUST_BOTTOM      0x20
  98.  
  99. #define LG_JUST_WITHLABEL   0x100
  100.  
  101. /* Internal use */
  102. struct LG_Rel_Data
  103. {
  104.   UBYTE RelGrp,Code;
  105.   union
  106.   {
  107.     WORD WData;
  108.     struct 
  109.     {
  110.       BYTE Byte1,
  111.            Byte2;
  112.     } _TwoBytes;
  113.   } _OneWord;
  114. };
  115.  
  116. /* Relational Macros! */
  117. #define LG_REL_W(RelType,Code,WordData)         (ULONG)( (RelType & 0xff)<<24 | (Code & 0xff)<<16 | (WordData & 0xffff) )
  118. #define LG_REL_BB(RelType,Code,Byte1,Byte2)     (ULONG)( (RelType & 0xff)<<24 | (Code & 0xff)<<16 | (Byte1 & 0xff )<<8 | (Byte2 & 0xff) )
  119.  
  120. /* Relative to current LG_Bounds */
  121. #define LG_REL_RIGHT(x)       LG_REL_W( 1, 0, x) // LG_LeftEdge
  122. #define LG_REL_WIDTH(x)       LG_REL_W( 1, 1, x) // LG_Width
  123. #define LG_REL_BOTTOM(y)      LG_REL_W( 1, 2, y) // LG_TopEdge
  124. #define LG_REL_HEIGHT(y)      LG_REL_W( 1, 3, y) // LG_Height
  125.  
  126. /* cell spacing/dimensions.
  127.    These work in conjunction with the LG_Columns & LG_Rows tagitems, 
  128.    relative to current bounds.  LG_RelGapX & Y are considered.
  129. */
  130. #define LG_REL_CELL_LEFTEDGE(column)    LG_REL_W( 1, 4, column)  // LG_LeftEdge Horizontal spacing
  131. #define LG_REL_CELL_TOPEDGE(row)        LG_REL_W( 1, 5, row)     // LG_TopEdge  Vertical spacing    
  132. #define LG_REL_CELL_WIDTH(x)            LG_REL_W( 1, 6, x)       // LG_Width    the width of x columns    
  133. #define LG_REL_CELL_HEIGHT(y)           LG_REL_W( 1, 7, y)       // LG_Height   the height of x rows 
  134.  
  135. /* relative to another gadget, (also considers label)
  136.    restrictions:
  137.       The gadget, GADGETID, must appear above the gadget using these 
  138.         LG_REL_ flags in the taglist.
  139.       GAP < -128 - 127 > 
  140. */
  141.       
  142. #define LG_REL_LEFTOF(GADGETID, GAP)    LG_REL( 2, GAP  , GADGETID) // LG_LeftEdge LG_Width
  143. #define LG_REL_TOPOF(GADGETID, GAP)     LG_REL( 3, GAP  , GADGETID) // LG_TopEdge  LG_Height
  144. #define LG_REL_WIDTHOF(GADGETID, GAP)   LG_REL( 4, GAP  , GADGETID) // LG_Width
  145. #define LG_REL_HEIGHTOF(GADGETID, GAP)  LG_REL( 5, GAP  , GADGETID) // LG_Height
  146. #define LG_REL_RIGHTOF(GADGETID, GAP)   LG_REL( 6, GAP  , GADGETID) // LG_LeftEdge LG_Width
  147. #define LG_REL_BOTTOMOF(GADGETID, GAP)  LG_REL( 7, GAP  , GADGETID) // LG_TopEdge  LG_Height
  148.  
  149.  
  150. struct LG_GadgetIndex
  151. {
  152.   ULONG  gi_ID;
  153.   struct Gadget *gi_Gadget;
  154.   struct Rectangle gi_Rect; /* refresh area */
  155.   ULONG  gi_Disabled,
  156.          gi_GadKind,
  157.          gi_KeyTagID,   
  158.          gi_KeyTagValue,
  159.          gi_KeyClass;
  160.   STRPTR gi_KeyString;
  161. };
  162.  
  163. struct LG_Control
  164. {
  165.   struct Gadget *lgc_GadgetList;
  166.   ULONG  lgc_GadgetCount;
  167.   struct LG_GadgetIndex *lgc_GadgetIndex;
  168.   ULONG  lgc_IndexCount;
  169.   struct Window *lgc_Window;
  170.   ULONG  lgc_Flags;
  171.   WORD   lgc_Left,lgc_Top,
  172.          lgc_Right,lgc_Bottom;
  173.   struct LG_Control *lgc_Next;
  174. };
  175.  
  176. struct lg_DimInfo
  177. {
  178.   WORD CellsHoriz , CellsVert,
  179.        GapHoriz   , GapVert;
  180. };
  181.  
  182. #define LGCF_ERASEREMOVED (1<<0)
  183.  
  184.  
  185. #define LG_PagedGroupBegin
  186. #define LG_Page
  187. #define LG_PagedGroupEnd
  188.  
  189.  
  190. #endif
  191.  
  192.